/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_TIPO_TELE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbTipoTele.findAll", query = "SELECT a FROM AmTbTipoTele a"),
    @NamedQuery(name = "AmTbTipoTele.findByCdTipoTele", query = "SELECT a FROM AmTbTipoTele a WHERE a.cdTipoTele = :cdTipoTele"),
    @NamedQuery(name = "AmTbTipoTele.findByNmTipoTele", query = "SELECT a FROM AmTbTipoTele a WHERE a.nmTipoTele = :nmTipoTele")})
public class AmTbTipoTele implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Basic(optional = false)
    @Column(name = "CD_TIPO_TELE")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "seq_AM_TB_TIPO_TELE")
    @SequenceGenerator(name="seq_AM_TB_TIPO_TELE", sequenceName = "seq_AM_TB_TIPO_TELE")
    private Short cdTipoTele;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "NM_TIPO_TELE")
    private String nmTipoTele;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdTipoTele")
    private Collection<AmTbTelePaci> amTbTelePaciCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdTipoTele")
    private Collection<AmTbTeleLocaAten> amTbTeleLocaAtenCollection;

    public AmTbTipoTele() {
    }

    public AmTbTipoTele(Short cdTipoTele) {
        this.cdTipoTele = cdTipoTele;
    }

    public AmTbTipoTele(Short cdTipoTele, String nmTipoTele) {
        this.cdTipoTele = cdTipoTele;
        this.nmTipoTele = nmTipoTele;
    }

    public Short getCdTipoTele() {
        return cdTipoTele;
    }

    public void setCdTipoTele(Short cdTipoTele) {
        this.cdTipoTele = cdTipoTele;
    }

    public String getNmTipoTele() {
        return nmTipoTele;
    }

    public void setNmTipoTele(String nmTipoTele) {
        this.nmTipoTele = nmTipoTele;
    }

    @XmlTransient
    public Collection<AmTbTelePaci> getAmTbTelePaciCollection() {
        return amTbTelePaciCollection;
    }

    public void setAmTbTelePaciCollection(Collection<AmTbTelePaci> amTbTelePaciCollection) {
        this.amTbTelePaciCollection = amTbTelePaciCollection;
    }

    @XmlTransient
    public Collection<AmTbTeleLocaAten> getAmTbTeleLocaAtenCollection() {
        return amTbTeleLocaAtenCollection;
    }

    public void setAmTbTeleLocaAtenCollection(Collection<AmTbTeleLocaAten> amTbTeleLocaAtenCollection) {
        this.amTbTeleLocaAtenCollection = amTbTeleLocaAtenCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdTipoTele != null ? cdTipoTele.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbTipoTele)) {
            return false;
        }
        AmTbTipoTele other = (AmTbTipoTele) object;
        if ((this.cdTipoTele == null && other.cdTipoTele != null) || (this.cdTipoTele != null && !this.cdTipoTele.equals(other.cdTipoTele))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbTipoTele[ cdTipoTele=" + cdTipoTele + " ]";
    }
    
}
